


use "${pathdata_robustness}/RobustnessExperiment1_noinfo.dta", clear





gen story = 0
replace story = 1 if inlist(treatment, "n=1_context")

gen statistic = 0
replace statistic = 1 if inlist(treatment, "n>1_nocontext")



preserve

tab condition_



* Calculate 99th percentile and 1st percentile for excess_wtp_zscore
egen p99_excess_wtp = pctile(excess_wtp), p(99)
egen p01_excess_wtp = pctile(excess_wtp), p(1)

* Winsorize excess_wtp_zscore manually
gen excess_wtp_winsor = excess_wtp
replace excess_wtp_winsor = p99_excess_wtp if excess_wtp_winsor > p99_excess_wtp
replace excess_wtp_winsor = p01_excess_wtp if excess_wtp_winsor < p01_excess_wtp

* Calculate 99th percentile and 1st percentile for excess_wtp_recall_zscore
egen p99_excess_wtp_recall = pctile(excess_wtp_recall), p(99)
egen p01_excess_wtp_recall = pctile(excess_wtp_recall), p(1)

* Winsorize excess_wtp_recall_zscore manually
gen excess_wtp_recall_winsor = excess_wtp_recall
replace excess_wtp_recall_winsor = p99_excess_wtp_recall if excess_wtp_recall_winsor > p99_excess_wtp_recall
replace excess_wtp_recall_winsor = p01_excess_wtp_recall if excess_wtp_recall_winsor < p01_excess_wtp_recall

replace excess_wtp_recall = excess_wtp_recall_winsor


egen mean_bicycle_1 = mean(excess_wtp) if product == "bicycle"
egen sd_bicycle_1 = sd(excess_wtp) if product == "bicycle"

egen mean_videogame_1 = mean(excess_wtp) if product == "videogame"
egen sd_videogame_1 = sd(excess_wtp) if product == "videogame"

egen mean_restaurant_1 = mean(excess_wtp) if product == "restaurant"
egen sd_restaurant_1 = sd(excess_wtp) if product == "restaurant"

egen mean_bicycle_2 = mean(excess_wtp_recall) if product == "bicycle"
egen sd_bicycle_2 = sd(excess_wtp_recall) if product == "bicycle"

egen mean_videogame_2 = mean(excess_wtp_recall) if product == "videogame"
egen sd_videogame_2 = sd(excess_wtp_recall) if product == "videogame"

egen mean_restaurant_2 = mean(excess_wtp_recall) if product == "restaurant"
egen sd_restaurant_2 = sd(excess_wtp_recall) if product == "restaurant"


gen excess_wtp_z = .
replace excess_wtp_z = (excess_wtp - mean_bicycle_1)/sd_bicycle_1 if product == "bicycle"
replace excess_wtp_z = (excess_wtp - mean_videogame_1)/sd_videogame_1 if product == "videogame"
replace excess_wtp_z = (excess_wtp - mean_restaurant_1)/sd_restaurant_1 if product == "restaurant"



gen excess_wtp_recall_z = .
replace excess_wtp_recall_z = (excess_wtp_recall - mean_bicycle_2)/sd_bicycle_2 if product == "bicycle"
replace excess_wtp_recall_z = (excess_wtp_recall - mean_videogame_2)/sd_videogame_2 if product == "videogame"
replace excess_wtp_recall_z = (excess_wtp_recall - mean_restaurant_2)/sd_restaurant_2 if product == "restaurant"


* Append the dataset with a copy of itself
expand 2, generate(newv)



* Generate the variables estimate and delay
gen wtp_impact = .
gen delay = .

* Set delay=1 for the first half of the new dataset and delay=0 for the second half
replace delay = 1 if newv == 0
replace delay = 0 if newv == 1

* Set estimate=beliefs_ for the first half and estimate=p_guess_ for the second half
replace wtp_impact = excess_wtp_recall_z if newv == 0
replace wtp_impact = excess_wtp_z if newv == 1

* Run the regression with clustered standard errors on prolific_pid

gen story_x_delay = story*delay

keep if inlist(condition_, "n=1_context_pos", "noinfo", "n=1_context_neg")



eststo clear
eststo: regress wtp_impact story delay story_x_delay, robust cluster(prolific_pid)




restore 



*tab condition_



*tab statistic


* Calculate 99th percentile and 1st percentile for excess_wtp_zscore
egen p99_excess_wtp = pctile(excess_wtp), p(99)
egen p01_excess_wtp = pctile(excess_wtp), p(1)

* Winsorize excess_wtp_zscore manually
gen excess_wtp_winsor = excess_wtp
replace excess_wtp_winsor = p99_excess_wtp if excess_wtp_winsor > p99_excess_wtp
replace excess_wtp_winsor = p01_excess_wtp if excess_wtp_winsor < p01_excess_wtp

* Calculate 99th percentile and 1st percentile for excess_wtp_recall_zscore
egen p99_excess_wtp_recall = pctile(excess_wtp_recall), p(99)
egen p01_excess_wtp_recall = pctile(excess_wtp_recall), p(1)

* Winsorize excess_wtp_recall_zscore manually
gen excess_wtp_recall_winsor = excess_wtp_recall
replace excess_wtp_recall_winsor = p99_excess_wtp_recall if excess_wtp_recall_winsor > p99_excess_wtp_recall
replace excess_wtp_recall_winsor = p01_excess_wtp_recall if excess_wtp_recall_winsor < p01_excess_wtp_recall

replace excess_wtp_recall = excess_wtp_recall_winsor



egen mean_bicycle_1 = mean(excess_wtp) if product == "bicycle"
egen sd_bicycle_1 = sd(excess_wtp) if product == "bicycle"

egen mean_videogame_1 = mean(excess_wtp) if product == "videogame"
egen sd_videogame_1 = sd(excess_wtp) if product == "videogame"

egen mean_restaurant_1 = mean(excess_wtp) if product == "restaurant"
egen sd_restaurant_1 = sd(excess_wtp) if product == "restaurant"

egen mean_bicycle_2 = mean(excess_wtp_recall) if product == "bicycle"
egen sd_bicycle_2 = sd(excess_wtp_recall) if product == "bicycle"

egen mean_videogame_2 = mean(excess_wtp_recall) if product == "videogame"
egen sd_videogame_2 = sd(excess_wtp_recall) if product == "videogame"

egen mean_restaurant_2 = mean(excess_wtp_recall) if product == "restaurant"
egen sd_restaurant_2 = sd(excess_wtp_recall) if product == "restaurant"


gen excess_wtp_z = .
replace excess_wtp_z = (excess_wtp - mean_bicycle_1)/sd_bicycle_1 if product == "bicycle"
replace excess_wtp_z = (excess_wtp - mean_videogame_1)/sd_videogame_1 if product == "videogame"
replace excess_wtp_z = (excess_wtp - mean_restaurant_1)/sd_restaurant_1 if product == "restaurant"


*tab excess_wtp_z


gen excess_wtp_recall_z = .
replace excess_wtp_recall_z = (excess_wtp_recall - mean_bicycle_2)/sd_bicycle_2 if product == "bicycle"
replace excess_wtp_recall_z = (excess_wtp_recall - mean_videogame_2)/sd_videogame_2 if product == "videogame"
replace excess_wtp_recall_z = (excess_wtp_recall - mean_restaurant_2)/sd_restaurant_2 if product == "restaurant"


* Append the dataset with a copy of itself
expand 2, generate(newv)



* Generate the variables estimate and delay
gen wtp_impact = .
gen delay = .

* Set delay=1 for the first half of the new dataset and delay=0 for the second half
replace delay = 1 if newv == 0
replace delay = 0 if newv == 1

* Set estimate=beliefs_ for the first half and estimate=p_guess_ for the second half
replace wtp_impact = excess_wtp_recall_z if newv == 0
replace wtp_impact = excess_wtp_z if newv == 1

* Run the regression with clustered standard errors on prolific_pid

gen statistic_x_delay = statistic*delay
keep if inlist(condition_, "n>1_nocontext_pos", "noinfo", "n>1_nocontext_neg")



eststo: regress wtp_impact statistic delay statistic_x_delay, robust cluster(prolific_pid)


* Export the regression table as a PNG to the current working directory
	 
esttab est1 est2 using "${pathout_robustness}/tables/tableA2.tex", label se ar2  ///
order(_cons story statistic delay story_x_delay statistic_x_delay) coeflabels(_cons "Constant" story "Story" statistic "Statistic" delay "Delay" story_x_delay "Story $/times$ Delay" statistic_x_delay "Statistic $/times$ Delay") ///
star(* 0.10 ** 0.05 *** 0.01) replace ///
title(WTP Regression/label{tab1})

